﻿package mvc {
	import org.puremvc.as3.multicore.interfaces.IFacade;
	import org.puremvc.as3.multicore.patterns.facade.Facade;
	import mvc.model.*;
	import mvc.view.*;
	import mvc.controller.*;
	
	public class PainterFacade extends Facade implements IFacade {
		
		public static const STARTUP			:String = "startup";
		
		public static const CLEAR			:String = "clear";
		public static const COLOR_CHANGE	:String = "colorChange";
		public static const MOUSE_DOWN		:String = "mouseDown";
		public static const MOUSE_MOVE		:String = "mouseMove";
		public static const TOOL_CHANGE		:String = "toolChange";
		
		public static function getInstance(key:String):PainterFacade {
			if (!instanceMap[key]) instanceMap[key] = new PainterFacade(key);
			return instanceMap[key] as PainterFacade;
		}
		
		public function PainterFacade(key:String) {
			super(key);
		}
		
		override protected function initializeController():void {
			super.initializeController();
			
			registerCommand(STARTUP, StartupCommand);
		}
		
		public function startup(application:*):void {
			sendNotification(STARTUP, application);
		}
	}
}